package main

import (
	"fmt"
	"reflect"
)

//比较俩个相同结构体不同的实例

type Base struct{
	Price   int
	Size     int
}

type Student struct{
	Base
	Name string
	Age int
}




func main() {

	s := Student{
		Name: "zhanglin",
		Age:  10,
		Base: Base{Price: 100, Size: 66},
	}

	t := reflect.TypeOf(s)
	v := reflect.ValueOf(s)
	for k := 0; k < t.NumField(); k++ {
        //fmt.Println(t.Field(k).Type, v.Field(k).Type())
		//fmt.Println(v.Field(k))
        if (v.Field(k).Kind() == reflect.Struct){
			v2 := v.Field(k)
			fmt.Println(v2.Field(0).Interface())
			fmt.Println(v2.Field(1).Interface())
		}

	}
}